* This is the do file for creating data files to calculate bootstrap standard errors in PSM 

use "$path_data/temp/followup_student_parents_matched", clear


// Cog
preserve
keep if treatment == 1
keep followup_cog_std DT_score_pre_std_missing_0 rosen_pre_std_missing_0 cpcs_pre_std_missing_0 grade student_gender branch1 branch2 branch3 income_source1 income_source2 income_source3 income_source4 last_income_per_member hhmember hhheadage hhheadeduyear phone_survey age_tchr
order followup_cog_std
export delimited using "$path_data/matlab/CogTre.csv", novarnames replace
restore
preserve
keep if treatment == 0
keep followup_cog_std DT_score_pre_std_missing_0 rosen_pre_std_missing_0 cpcs_pre_std_missing_0 grade student_gender branch1 branch2 branch3 income_source1 income_source2 income_source3 income_source4 last_income_per_member hhmember hhheadage hhheadeduyear phone_survey age_tchr
order followup_cog_std
export delimited using "$path_data/matlab/CogCon.csv", novarnames replace
restore

// RSES
preserve
keep if treatment == 1
keep RSES_std DT_score_pre_std_missing_0 rosen_pre_std_missing_0 cpcs_pre_std_missing_0 grade student_gender branch1 branch2 branch3 income_source1 income_source2 income_source3 income_source4 last_income_per_member hhmember hhheadage hhheadeduyear phone_survey age_tchr
order RSES_std
export delimited using "$path_data/matlab/RSESTre.csv", novarnames replace
restore
preserve
keep if treatment == 0
keep RSES_std DT_score_pre_std_missing_0 rosen_pre_std_missing_0 cpcs_pre_std_missing_0 grade student_gender branch1 branch2 branch3 income_source1 income_source2 income_source3 income_source4 last_income_per_member hhmember hhheadage hhheadeduyear phone_survey age_tchr
order RSES_std
export delimited using "$path_data/matlab/RSESCon.csv", novarnames replace
restore

// CPCS
preserve
keep if treatment == 1
keep CPCS_std DT_score_pre_std_missing_0 rosen_pre_std_missing_0 cpcs_pre_std_missing_0 grade student_gender branch1 branch2 branch3 income_source1 income_source2 income_source3 income_source4 last_income_per_member hhmember hhheadage hhheadeduyear phone_survey age_tchr
order CPCS_std
export delimited using "$path_data/matlab/CPCSTre.csv", novarnames replace
restore
preserve
keep if treatment == 0
keep CPCS_std DT_score_pre_std_missing_0 rosen_pre_std_missing_0 cpcs_pre_std_missing_0 grade student_gender branch1 branch2 branch3 income_source1 income_source2 income_source3 income_source4 last_income_per_member hhmember hhheadage hhheadeduyear phone_survey age_tchr
order CPCS_std
export delimited using "$path_data/matlab/CPCSCon.csv", novarnames replace
restore

// Cluster
preserve
keep if treatment == 1
keep school_no
export delimited using "$path_data/matlab/ClusTre.csv", novarnames replace
restore
preserve
keep if treatment == 0
keep school_no
export delimited using "$path_data/matlab/ClusCon.csv", novarnames replace
restore
